package com.boyunv.state.example03;
/*
 *@description
 *  交通灯类
 *@author boyunv
 *@create 2023/8/30 20:41
 *@version 1.0
 */

import lombok.Setter;

public class TrafficLight {
    //初始化  红灯
    @Setter
    State state=new RedState();
    
    
    public void  switchToGreen(){
        state.switchToGreen(this);
    }
    public void  switchToRed(){
        state.switchToRed(this);
    }
    public void  switchToYellow(){
        state.switchToYellow(this);
    }
        
   
}
